package com.lzh.common.exception;

import com.lzh.common.pojo.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {
    /**
     * 异常捕获
     */
    @ExceptionHandler(value =Exception.class )
    public Result handlerException(Exception ex){
        log.error(ex.getMessage(),ex);
        return Result.errorMessage("系统发生错误，请稍后再试！");
    }
}
